package com.fr.base;

public class BooleanUtils
{
  public static Boolean negate(Boolean paramBoolean)
  {
    if (paramBoolean == null)
      return null;
    return ((paramBoolean.booleanValue()) ? Boolean.FALSE : Boolean.TRUE);
  }

  public static boolean isTrue(Boolean paramBoolean)
  {
    if (paramBoolean == null)
      return false;
    return (paramBoolean.booleanValue());
  }

  public static boolean isNotTrue(Boolean paramBoolean)
  {
    return (!(isTrue(paramBoolean)));
  }

  public static boolean isFalse(Boolean paramBoolean)
  {
    if (paramBoolean == null)
      return false;
    return (!(paramBoolean.booleanValue()));
  }

  public static boolean isNotFalse(Boolean paramBoolean)
  {
    return (!(isFalse(paramBoolean)));
  }

  public static Boolean toBooleanObject(boolean paramBoolean)
  {
    return ((paramBoolean) ? Boolean.TRUE : Boolean.FALSE);
  }

  public static boolean toBoolean(Boolean paramBoolean)
  {
    if (paramBoolean == null)
      return false;
    return (paramBoolean.booleanValue());
  }

  public static boolean toBooleanDefaultIfNull(Boolean paramBoolean, boolean paramBoolean1)
  {
    if (paramBoolean == null)
      return paramBoolean1;
    return (paramBoolean.booleanValue());
  }

  public static boolean toBoolean(int paramInt)
  {
    return (paramInt != 0);
  }

  public static Boolean toBooleanObject(int paramInt)
  {
    return ((paramInt == 0) ? Boolean.FALSE : Boolean.TRUE);
  }

  public static Boolean toBooleanObject(Integer paramInteger)
  {
    if (paramInteger == null)
      return null;
    return ((paramInteger.intValue() == 0) ? Boolean.FALSE : Boolean.TRUE);
  }

  public static boolean toBoolean(int paramInt1, int paramInt2, int paramInt3)
  {
    if (paramInt1 == paramInt2)
      return true;
    if (paramInt1 == paramInt3)
      return false;
    throw new IllegalArgumentException("The Integer did not match either specified value");
  }

  public static boolean toBoolean(Integer paramInteger1, Integer paramInteger2, Integer paramInteger3)
  {
    if (paramInteger1 == null)
    {
      if (paramInteger2 == null)
        return true;
      if (paramInteger3 != null)
        break label36;
      return false;
    }
    if (paramInteger1.equals(paramInteger2))
      return true;
    if (paramInteger1.equals(paramInteger3))
      return false;
    label36: throw new IllegalArgumentException("The Integer did not match either specified value");
  }

  public static Boolean toBooleanObject(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    if (paramInt1 == paramInt2)
      return Boolean.TRUE;
    if (paramInt1 == paramInt3)
      return Boolean.FALSE;
    if (paramInt1 == paramInt4)
      return null;
    throw new IllegalArgumentException("The Integer did not match any specified value");
  }

  public static Boolean toBooleanObject(Integer paramInteger1, Integer paramInteger2, Integer paramInteger3, Integer paramInteger4)
  {
    if (paramInteger1 == null)
    {
      if (paramInteger2 == null)
        return Boolean.TRUE;
      if (paramInteger3 == null)
        return Boolean.FALSE;
      if (paramInteger4 != null)
        break label60;
      return null;
    }
    if (paramInteger1.equals(paramInteger2))
      return Boolean.TRUE;
    if (paramInteger1.equals(paramInteger3))
      return Boolean.FALSE;
    if (paramInteger1.equals(paramInteger4))
      return null;
    label60: throw new IllegalArgumentException("The Integer did not match any specified value");
  }

  public static int toInteger(boolean paramBoolean)
  {
    return ((paramBoolean) ? 1 : 0);
  }

  public static int toInteger(boolean paramBoolean, int paramInt1, int paramInt2)
  {
    return ((paramBoolean) ? paramInt1 : paramInt2);
  }

  public static int toInteger(Boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3)
  {
    if (paramBoolean == null)
      return paramInt3;
    return ((paramBoolean.booleanValue()) ? paramInt1 : paramInt2);
  }

  public static Integer toIntegerObject(boolean paramBoolean, Integer paramInteger1, Integer paramInteger2)
  {
    return ((paramBoolean) ? paramInteger1 : paramInteger2);
  }

  public static Integer toIntegerObject(Boolean paramBoolean, Integer paramInteger1, Integer paramInteger2, Integer paramInteger3)
  {
    if (paramBoolean == null)
      return paramInteger3;
    return ((paramBoolean.booleanValue()) ? paramInteger1 : paramInteger2);
  }

  public static Boolean toBooleanObject(String paramString)
  {
    if ("true".equalsIgnoreCase(paramString))
      return Boolean.TRUE;
    if ("false".equalsIgnoreCase(paramString))
      return Boolean.FALSE;
    if ("on".equalsIgnoreCase(paramString))
      return Boolean.TRUE;
    if ("off".equalsIgnoreCase(paramString))
      return Boolean.FALSE;
    if ("yes".equalsIgnoreCase(paramString))
      return Boolean.TRUE;
    if ("no".equalsIgnoreCase(paramString))
      return Boolean.FALSE;
    return null;
  }

  public static Boolean toBooleanObject(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    if (paramString1 == null)
    {
      if (paramString2 == null)
        return Boolean.TRUE;
      if (paramString3 == null)
        return Boolean.FALSE;
      if (paramString4 != null)
        break label60;
      return null;
    }
    if (paramString1.equals(paramString2))
      return Boolean.TRUE;
    if (paramString1.equals(paramString3))
      return Boolean.FALSE;
    if (paramString1.equals(paramString4))
      return null;
    label60: throw new IllegalArgumentException("The String did not match any specified value");
  }

  public static boolean toBoolean(String paramString)
  {
    int i;
    if (paramString == "true")
      return true;
    if (paramString == null)
      return false;
    switch (paramString.length())
    {
    case 2:
      i = paramString.charAt(0);
      int j = paramString.charAt(1);
      return ((((i == 111) || (i == 79))) && (((j == 110) || (j == 78))));
    case 3:
      i = paramString.charAt(0);
      if (i == 121)
        return ((((paramString.charAt(1) == 'e') || (paramString.charAt(1) == 'E'))) && (((paramString.charAt(2) == 's') || (paramString.charAt(2) == 'S'))));
      if (i == 89)
        return ((((paramString.charAt(1) == 'E') || (paramString.charAt(1) == 'e'))) && (((paramString.charAt(2) == 'S') || (paramString.charAt(2) == 's'))));
      return false;
    case 4:
      i = paramString.charAt(0);
      if (i == 116)
        return ((((paramString.charAt(1) == 'r') || (paramString.charAt(1) == 'R'))) && (((paramString.charAt(2) == 'u') || (paramString.charAt(2) == 'U'))) && (((paramString.charAt(3) == 'e') || (paramString.charAt(3) == 'E'))));
      if (i != 84)
        break label348;
      return ((((paramString.charAt(1) == 'R') || (paramString.charAt(1) == 'r'))) && (((paramString.charAt(2) == 'U') || (paramString.charAt(2) == 'u'))) && (((paramString.charAt(3) == 'E') || (paramString.charAt(3) == 'e'))));
    }
    label348: return false;
  }

  public static boolean toBoolean(String paramString1, String paramString2, String paramString3)
  {
    if (paramString1 == null)
    {
      if (paramString2 == null)
        return true;
      if (paramString3 != null)
        break label36;
      return false;
    }
    if (paramString1.equals(paramString2))
      return true;
    if (paramString1.equals(paramString3))
      return false;
    label36: throw new IllegalArgumentException("The String did not match either specified value");
  }

  public static String toStringTrueFalse(Boolean paramBoolean)
  {
    return toString(paramBoolean, "true", "false", null);
  }

  public static String toStringOnOff(Boolean paramBoolean)
  {
    return toString(paramBoolean, "on", "off", null);
  }

  public static String toStringYesNo(Boolean paramBoolean)
  {
    return toString(paramBoolean, "yes", "no", null);
  }

  public static String toString(Boolean paramBoolean, String paramString1, String paramString2, String paramString3)
  {
    if (paramBoolean == null)
      return paramString3;
    return ((paramBoolean.booleanValue()) ? paramString1 : paramString2);
  }

  public static String toStringTrueFalse(boolean paramBoolean)
  {
    return toString(paramBoolean, "true", "false");
  }

  public static String toStringOnOff(boolean paramBoolean)
  {
    return toString(paramBoolean, "on", "off");
  }

  public static String toStringYesNo(boolean paramBoolean)
  {
    return toString(paramBoolean, "yes", "no");
  }

  public static String toString(boolean paramBoolean, String paramString1, String paramString2)
  {
    return ((paramBoolean) ? paramString1 : paramString2);
  }

  public static boolean xor(boolean[] paramArrayOfBoolean)
  {
    if (paramArrayOfBoolean == null)
      throw new IllegalArgumentException("The Array must not be null");
    if (paramArrayOfBoolean.length == 0)
      throw new IllegalArgumentException("Array is empty");
    int i = 0;
    for (int j = 0; j < paramArrayOfBoolean.length; ++j)
      if (paramArrayOfBoolean[j] != 0)
        if (i < 1)
          ++i;
        else
          return false;
    return (i == 1);
  }

  public static Boolean xor(Boolean[] paramArrayOfBoolean)
  {
    if (paramArrayOfBoolean == null)
      throw new IllegalArgumentException("The Array must not be null");
    if (paramArrayOfBoolean.length == 0)
      throw new IllegalArgumentException("Array is empty");
    boolean[] arrayOfBoolean = null;
    try
    {
      arrayOfBoolean = ArrayUtils.toPrimitive(paramArrayOfBoolean);
    }
    catch (NullPointerException localNullPointerException)
    {
      throw new IllegalArgumentException("The array must not contain any null elements");
    }
    return ((xor(arrayOfBoolean)) ? Boolean.TRUE : Boolean.FALSE);
  }
}